print("Введите скобочную последовательность")
v = input()
p1 = ""


for char in v:
    if char == "(":
        p1 += char

    if char == ")":
        if len(p1)>0:
            if p1[len(p1) - 1] == "(":
                p1 = p1[: -1]

    if char == "[":
        p1 += char

    if char == "]":
        if len(p1)>0:
            if p1[len(p1) - 1] == "[":
                p1 = p1[: -1]

    if char == "{":
        p1 += char

    if char == "}":
        if len(p1)>0:
            if p1[len(p1) - 1] == "{":
                p1 = p1[: -1]

    if char == "<":
        p1 += char

    if char == ">":
        if len(p1)>0:
            if p1[len(p1) - 1] == "<":
                p1 = p1[: -1]
        print(p1)

if len(p1)==0:
    print("Верная")
else:
    print("Неверная")
